package com.phpxiu.app.adapter;

import android.content.Context;
import android.net.Uri;
import android.view.View;
import android.view.ViewGroup;

import com.phpxiu.app.adapter.holder.RoomManagerViewHolder2;
import com.phpxiu.app.kkylive.R;
import com.phpxiu.app.model.list.AdminListContent;

import java.util.List;

/**
 * Created by 吴金洲 on 2016/8/12
 */
public class RoomManagersAdapter extends BaseAdapter<AdminListContent> {

    public RoomManagersAdapter(Context context, List<AdminListContent> data) {
        super(context, data);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        AdminListContent content=data.get(position);
        RoomManagerViewHolder2 holder;
        if(convertView==null){
            convertView=mInflater.inflate(R.layout.room_manager_list_item_view2,null);
            holder=new RoomManagerViewHolder2(convertView);
            convertView.setTag(holder);
        }
        holder=(RoomManagerViewHolder2)convertView.getTag();
        holder.setUid(content.getUid());
        holder.setPosition(position);
        holder.headView.setImageURI(Uri.parse(content.getAvatar()));
        holder.nickView.setText(content.getNickname());
        String sex=content.getSex();
        if("1".equals(sex)){
            holder.sexView.setImageResource(R.mipmap.user_sex_icon_male);
        }else{
            holder.sexView.setImageResource(R.mipmap.user_sex_icon_female);
        }
        if(!"".equals(content.getLvl())){
            //holder.lv.setVisibility(View.VISIBLE);
            //holder.lv.setImageURI(Uri.parse("asset:///lvIcons/" + content.getLvl() + ".png"));
        }else{
            //holder.lv.setVisibility(View.INVISIBLE);
        }
        holder.setIntroViewText(content.getIntro());
        holder.showDivider();
        if(data.size()>0&&position==data.size()-1){
            holder.hideDivider();
        }
        return convertView;
    }
}
